use crate::dto;
use crate::dto::endpoint_peer::EndpointPeerInfo;
use serde::{Deserialize, Serialize};
use validator::Validate;
use wanmesh_common::validator::validate_string_is_not_empty;

pub type ListInfoResponseData = wanmesh_common::dto::ListResponseData<EndpointPeerInfo>;

pub type AddRequest = AddParams;

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct AddParams {
    #[serde(flatten)]
    pub inner: dto::core::endpoint_peer::AddParams,
    pub wireguard: Option<dto::core::endpoint_peer_wireguard_config::AddParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct GetRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub endpoint_peer_id: String,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct DeleteRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub endpoint_peer_id: String,
}

pub type ListRequest = wanmesh_common::dto::ListRequest<dto::core::endpoint_peer::Filter>;
pub type ListResponseData =
    wanmesh_common::dto::ListResponseData<dto::core::endpoint_peer::EndpointPeerItem>;